this.BX=this.BX||{};this.BX.UI=this.BX.UI||{};(function(e,t,i,s,n,r,l,a){"use strict";var o={progress:"PROGRESS",completed:"COMPLETED"};var u={intermediate:"INTERMEDIATE",running:"RUNNING",completed:"COMPLETED",stopped:"STOPPED",error:"ERROR",canceling:"CANCELING"};var h,p,d,c,f,g,y,b;var v=function(){function e(t){babelHelpers.classCallCheck(this,e);babelHelpers.defineProperty(this,"obligatory",false);babelHelpers.defineProperty(this,"emptyMessage","");babelHelpers.defineProperty(this,"className","");babelHelpers.defineProperty(this,"disabled",false);babelHelpers.defineProperty(this,"value",null);this.id="id"in t?t.id:"ProcessDialogField_"+Math.random().toString().substring(2);this.name=t.name;this.type=t.type;this.title=t.title;this.obligatory=!!t.obligatory;if("value"in t){this.setValue(t.value)}if("emptyMessage"in t){this.emptyMessage=t.emptyMessage}else{this.emptyMessage=a.Loc.getMessage("UI_STEP_PROCESSING_EMPTY_ERROR")||""}}babelHelpers.createClass(e,[{key:"setValue",value:function e(t){throw new Error("BX.UI.StepProcessing: Must be implemented by a subclass")}},{key:"getValue",value:function e(){throw new Error("BX.UI.StepProcessing: Must be implemented by a subclass")}},{key:"render",value:function e(){throw new Error("BX.UI.StepProcessing: Must be implemented by a subclass")}},{key:"lock",value:function e(){throw new Error("BX.UI.StepProcessing: Must be implemented by a subclass")}},{key:"isFilled",value:function e(){throw new Error("BX.UI.StepProcessing: Must be implemented by a subclass")}},{key:"getInput",value:function e(){return this.field?this.field:null}},{key:"getContainer",value:function e(){if(!this.container){this.container=a.Tag.render(h||(h=babelHelpers.taggedTemplateLiteral(['<div class="'," ",'"></div>'])),X.ProcessOptionContainer,this.className);this.container.appendChild(a.Tag.render(p||(p=babelHelpers.taggedTemplateLiteral(['<div class="','"></div>'])),X.ProcessOptionsTitle)).appendChild(a.Tag.render(d||(d=babelHelpers.taggedTemplateLiteral(['<label for="','_inp">',"</label>"])),this.id,this.title));this.container.appendChild(a.Tag.render(c||(c=babelHelpers.taggedTemplateLiteral(['<div class="','"></div>'])),X.ProcessOptionsInput)).appendChild(this.render());if(this.obligatory){var t=this.id+"_alert";this.container.appendChild(a.Tag.render(f||(f=babelHelpers.taggedTemplateLiteral(['<div id="','" class="','" style="display:none"></div>'])),t,X.ProcessOptionsObligatory)).appendChild(a.Tag.render(g||(g=babelHelpers.taggedTemplateLiteral(['<span class="ui-alert-message">',"</span>"])),this.emptyMessage))}}return this.container}},{key:"showWarning",value:function e(t){var i=this.id+"_alert";var s=this.container.querySelector("#"+i);if(s){if(a.Type.isStringFilled(t)){var n=s.querySelector(".ui-alert-message");n.innerHTML=t}s.style.display="block"}else{var r=r?r:this.emptyMessage;if(a.Type.isStringFilled(r)){this.container.appendChild(a.Tag.render(y||(y=babelHelpers.taggedTemplateLiteral(['<div id="','" class="','"></div>'])),i,X.ProcessOptionsObligatory)).appendChild(a.Tag.render(b||(b=babelHelpers.taggedTemplateLiteral(['<span class="ui-alert-message">',"</span>"])),r))}}return this}},{key:"hideWarning",value:function e(){var t=this.id+"_alert";var i=this.container.querySelector("#"+t);if(i){i.style.display="none"}return this}}]);return e}();var m;var S=function(e){babelHelpers.inherits(t,e);function t(e){var i;babelHelpers.classCallCheck(this,t);i=babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(t).call(this,e));babelHelpers.defineProperty(babelHelpers.assertThisInitialized(i),"type","text");babelHelpers.defineProperty(babelHelpers.assertThisInitialized(i),"className",X.ProcessOptionText);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(i),"rows",10);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(i),"cols",50);if(e.textSize){i.cols=e.textSize}if(e.textLine){i.rows=e.textLine}return i}babelHelpers.createClass(t,[{key:"setValue",value:function e(t){this.value=t;if(this.field){this.field.value=this.value}return this}},{key:"getValue",value:function e(){if(this.field&&this.disabled!==true){if(typeof this.field.value!=="undefined"){this.value=this.field.value}}return this.value}},{key:"isFilled",value:function e(){if(this.field){if(typeof this.field.value!=="undefined"){return a.Type.isStringFilled(this.field.value)}}return false}},{key:"render",value:function e(){if(!this.field){this.field=a.Tag.render(m||(m=babelHelpers.taggedTemplateLiteral(['<textarea id="','" name="','" cols="','" rows="','"></textarea>'])),this.id,this.name,this.cols,this.rows)}if(this.value){this.field.value=this.value}return this.field}},{key:"lock",value:function e(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;this.disabled=t;this.field.disabled=!!t;return this}}]);return t}(v);var k;var B=function(e){babelHelpers.inherits(t,e);function t(e){var i;babelHelpers.classCallCheck(this,t);if(!("emptyMessage"in e)){e.emptyMessage=a.Loc.getMessage("UI_STEP_PROCESSING_FILE_EMPTY_ERROR")}i=babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(t).call(this,e));babelHelpers.defineProperty(babelHelpers.assertThisInitialized(i),"type","file");babelHelpers.defineProperty(babelHelpers.assertThisInitialized(i),"className",X.ProcessOptionFile);return i}babelHelpers.createClass(t,[{key:"setValue",value:function e(t){this.value=t;if(this.field){if(t instanceof FileList){this.field.files=t}else if(t instanceof File){this.field.files[0]=t}}return this}},{key:"getValue",value:function e(){if(this.field&&this.disabled!==true){if(typeof this.field.files[0]!="undefined"){this.value=this.field.files[0]}}return this.value}},{key:"isFilled",value:function e(){if(this.field){if(typeof this.field.files[0]!="undefined"){return true}}return false}},{key:"render",value:function e(){if(!this.field){this.field=a.Tag.render(k||(k=babelHelpers.taggedTemplateLiteral(['<input type="file" id="','" name="','">'])),this.id,this.name)}return this.field}},{key:"lock",value:function e(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;this.disabled=t;this.field.disabled=!!t;return this}}]);return t}(v);var T,P,C,E,O,H,w;var R=function(e){babelHelpers.inherits(t,e);function t(e){var i;babelHelpers.classCallCheck(this,t);i=babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(t).call(this,e));babelHelpers.defineProperty(babelHelpers.assertThisInitialized(i),"type","checkbox");babelHelpers.defineProperty(babelHelpers.assertThisInitialized(i),"list",[]);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(i),"multiple",false);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(i),"className",X.ProcessOptionCheckbox);if("list"in e){i.list=e.list}i.multiple=i.list.length>1;if(i.multiple){i["class"]=X.ProcessOptionMultiple}return i}babelHelpers.createClass(t,[{key:"setValue",value:function e(t){if(this.multiple){this.value=a.Type.isArray(t)?t:[t]}else{if(t==="Y"||t==="N"||t===null||t===undefined){t=t==="Y"}this.value=t}if(this.field){if(this.multiple){var i=this.field.querySelectorAll("input[type=checkbox]");if(i){for(var s=0;s<i.length;s++){i[s].checked=this.value.indexOf(i[s].value)!==-1}}}else{var n=this.field.querySelector("input[type=checkbox]");if(n){n.checked=a.Type.isBoolean(this.value)?this.value:n.value===this.value}}}return this}},{key:"getValue",value:function e(){if(this.field&&this.disabled!==true){if(this.multiple){this.value=[];var t=this.field.querySelectorAll("input[type=checkbox]");if(t){for(var i=0;i<t.length;i++){if(t[i].checked){this.value.push(t[i].value)}}}}else{var s=this.field.querySelector("input[type=checkbox]");if(s){if(s.value&&s.value!=="Y"){this.value=s.checked?s.value:""}else{this.value=s.checked}}}}return this.value}},{key:"isFilled",value:function e(){if(this.field){var t=this.field.querySelectorAll("input[type=checkbox]");if(t){return true}}return false}},{key:"getInput",value:function e(){if(this.field){if(this.multiple){var t=this.field.querySelectorAll("input[type=checkbox]");if(t){return t}}else{var i=this.field.querySelector("input[type=checkbox]");if(i){return i}}}return null}},{key:"render",value:function e(){var t=this;if(!this.field){this.field=a.Tag.render(T||(T=babelHelpers.taggedTemplateLiteral(['<div id="','"></div>'])),this.id)}if(this.multiple){Object.keys(this.list).forEach((function(e){if(t.value.indexOf(e)!==-1){t.field.appendChild(a.Tag.render(P||(P=babelHelpers.taggedTemplateLiteral(['<label><input type="checkbox" name="','[]" value="','" checked>',"</label>"])),t.name,e,t.list[e]))}else{t.field.appendChild(a.Tag.render(C||(C=babelHelpers.taggedTemplateLiteral(['<label><input type="checkbox" name="','[]" value="','">',"</label>"])),t.name,e,t.list[e]))}}))}else{if(a.Type.isBoolean(this.value)){if(this.value){this.field.appendChild(a.Tag.render(E||(E=babelHelpers.taggedTemplateLiteral(['<input type="checkbox" id="','_inp" name="','" value="Y" checked>'])),this.id,this.name))}else{this.field.appendChild(a.Tag.render(O||(O=babelHelpers.taggedTemplateLiteral(['<input type="checkbox" id="','_inp" name="','" value="Y">'])),this.id,this.name))}}else{if(this.value!==""){this.field.appendChild(a.Tag.render(H||(H=babelHelpers.taggedTemplateLiteral(['<input type="checkbox" id="','_inp" name="','" value="','" checked>'])),this.id,this.name,this.value))}else{this.field.appendChild(a.Tag.render(w||(w=babelHelpers.taggedTemplateLiteral(['<input type="checkbox" id="','_inp" name="','" value="','>"'])),this.id,this.name,this.value))}}}return this.field}},{key:"lock",value:function e(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;this.disabled=t;if(this.field){var i=this.field.querySelectorAll("input[type=checkbox]");if(i){for(var s=0;s<i.length;s++){i[s].disabled=!!t}}}return this}}]);return t}(v);var I,_;var D=function(e){babelHelpers.inherits(t,e);function t(e){var i;babelHelpers.classCallCheck(this,t);i=babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(t).call(this,e));babelHelpers.defineProperty(babelHelpers.assertThisInitialized(i),"type","select");babelHelpers.defineProperty(babelHelpers.assertThisInitialized(i),"multiple",false);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(i),"list",[]);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(i),"className",X.ProcessOptionSelect);if("multiple"in e){i.multiple=a.Type.isBoolean(e.multiple)?e.multiple===true:e.multiple==="Y"}if(i.multiple){if("size"in e){i.size=e.size}}if("list"in e){i.list=e.list}return i}babelHelpers.createClass(t,[{key:"setValue",value:function e(t){if(this.multiple){this.value=a.Type.isArray(t)?t:[t]}else{this.value=t}if(this.field){if(this.multiple){for(var i=0;i<this.field.options.length;i++){this.field.options[i].selected=this.value.indexOf(this.field.options[i].value)!==-1}}else{this.field.value=this.value}}return this}},{key:"getValue",value:function e(){if(this.field&&this.disabled!==true){if(this.multiple){this.value=[];for(var t=0;t<this.field.options.length;t++){if(this.field.options[t].selected){this.value.push(this.field.options[t].value)}}}else{this.value=this.field.value}}return this.value}},{key:"isFilled",value:function e(){if(this.field){for(var t=0;t<this.field.options.length;t++){if(this.field.options[t].selected){return true}}}return false}},{key:"render",value:function e(){var t=this;if(!this.field){this.field=a.Tag.render(I||(I=babelHelpers.taggedTemplateLiteral(['<select id="','" name="','"></select>'])),this.id,this.name)}if(this.multiple){this.field.multiple="multiple";if(this.size){this.field.size=this.size}}Object.keys(this.list).forEach((function(e){var i;if(t.multiple===true){i=t.value.indexOf(e)!==-1}else{i=e===t.value}var s=t.field.appendChild(a.Tag.render(_||(_=babelHelpers.taggedTemplateLiteral(['<option value="','">',"</option>"])),e,t.list[e]));if(i){s.selected="selected"}}));return this.field}},{key:"lock",value:function e(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;this.disabled=t;this.field.disabled=!!t;return this}}]);return t}(v);var q,M,x;var A=function(e){babelHelpers.inherits(t,e);function t(e){var i;babelHelpers.classCallCheck(this,t);i=babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(t).call(this,e));babelHelpers.defineProperty(babelHelpers.assertThisInitialized(i),"type","radio");babelHelpers.defineProperty(babelHelpers.assertThisInitialized(i),"list",[]);babelHelpers.defineProperty(babelHelpers.assertThisInitialized(i),"className",X.ProcessOptionMultiple);if("list"in e){i.list=e.list}return i}babelHelpers.createClass(t,[{key:"setValue",value:function e(t){this.value=t;if(this.field){var i=this.field.querySelectorAll("input[type=radio]");if(i){for(var s=0;s<i.length;s++){i[s].checked=i[s].value===this.value}}}return this}},{key:"getValue",value:function e(){if(this.field){var t=this.field.querySelectorAll("input[type=radio]");if(t){for(var i=0;i<t.length;i++){if(t[i].checked){this.value=t[i].value;break}}}}return this.value}},{key:"isFilled",value:function e(){if(this.field){var t=this.field.querySelectorAll("input[type=radio]");if(t){for(var i=0;i<t.length;i++){if(t[i].checked){return true}}}}return false}},{key:"getInput",value:function e(){if(this.field&&this.disabled!==true){var t=this.field.querySelector("input[type=radio]");if(t){return t}}return null}},{key:"render",value:function e(){var t=this;if(!this.field){this.field=a.Tag.render(q||(q=babelHelpers.taggedTemplateLiteral(['<div id="','"></div>'])),this.id)}Object.keys(this.list).forEach((function(e){if(e===t.value){t.field.appendChild(a.Tag.render(M||(M=babelHelpers.taggedTemplateLiteral(['<label><input type="radio" name="','" value="','" checked>',"</label>"])),t.name,e,t.list[e]))}else{t.field.appendChild(a.Tag.render(x||(x=babelHelpers.taggedTemplateLiteral(['<label><input type="radio" name="','" value="','">',"</label>"])),t.name,e,t.list[e]))}}));return this.field}},{key:"lock",value:function e(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;this.disabled=t;if(this.field){var i=this.field.querySelectorAll("input[type=radio]");if(i){for(var s=0;s<i.length;s++){i[s].disabled=!!t}}}return this}}]);return t}(v);var F,L,N,j;var X={ProcessWindow:"bx-stepprocessing-dialog-process",ProcessPopup:"bx-stepprocessing-dialog-process-popup",ProcessSummary:"bx-stepprocessing-dialog-process-summary",ProcessProgressbar:"bx-stepprocessing-dialog-process-progressbar",ProcessOptions:"bx-stepprocessing-dialog-process-options",ProcessOptionContainer:"bx-stepprocessing-dialog-process-option-container",ProcessOptionsTitle:"bx-stepprocessing-dialog-process-options-title",ProcessOptionsInput:"bx-stepprocessing-dialog-process-options-input",ProcessOptionsObligatory:"ui-alert ui-alert-xs ui-alert-warning",ProcessOptionText:"bx-stepprocessing-dialog-process-option-text",ProcessOptionCheckbox:"bx-stepprocessing-dialog-process-option-checkbox",ProcessOptionMultiple:"bx-stepprocessing-dialog-process-option-multiple",ProcessOptionFile:"bx-stepprocessing-dialog-process-option-file",ProcessOptionSelect:"bx-stepprocessing-dialog-process-option-select",ButtonStart:"popup-window-button-accept",ButtonStop:"popup-window-button-disable",ButtonCancel:"popup-window-button-link-cancel",ButtonDownload:"popup-window-button-link-download",ButtonRemove:"popup-window-button-link-remove"};var W={Shown:"BX.UI.StepProcessing.Dialog.Shown",Closed:"BX.UI.StepProcessing.Dialog.Closed",Start:"BX.UI.StepProcessing.Dialog.Start",Stop:"BX.UI.StepProcessing.Dialog.Stop"};var U=function(){function e(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};babelHelpers.classCallCheck(this,e);babelHelpers.defineProperty(this,"id","");babelHelpers.defineProperty(this,"_settings",{});babelHelpers.defineProperty(this,"isShown",false);babelHelpers.defineProperty(this,"buttons",{});babelHelpers.defineProperty(this,"fields",{});babelHelpers.defineProperty(this,"_messages",{});babelHelpers.defineProperty(this,"_handlers",{});babelHelpers.defineProperty(this,"isAdminPanel",false);this._settings=t;this.id=this.getSetting("id","ProcessDialog_"+Math.random().toString().substring(2));this._messages=this.getSetting("messages",{});var i={};var s=this.getSetting("optionsFields");if(a.Type.isArray(s)){s.forEach((function(e){if(a.Type.isPlainObject(e)&&e.hasOwnProperty("name")&&e.hasOwnProperty("type")&&e.hasOwnProperty("title")){i[e.name]=e}}))}else if(a.Type.isPlainObject(s)){Object.keys(s).forEach((function(e){var t=s[e];if(a.Type.isPlainObject(t)&&t.hasOwnProperty("name")&&t.hasOwnProperty("type")&&t.hasOwnProperty("title")){i[t.name]=t}}))}this.setSetting("optionsFields",i);var n=this.getSetting("optionsFieldsValue");if(!n){this.setSetting("optionsFieldsValue",{})}var r=this.getSetting("showButtons");if(!r){this.setSetting("showButtons",{start:true,stop:true,close:true})}this._handlers=this.getSetting("handlers",{})}babelHelpers.createClass(e,[{key:"destroy",value:function e(){if(this.popupWindow){this.popupWindow.destroy();this.popupWindow=null}}},{key:"getId",value:function e(){return this.id}},{key:"getSetting",value:function e(t){var i=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;return this._settings.hasOwnProperty(t)?this._settings[t]:i}},{key:"setSetting",value:function e(t,i){this._settings[t]=i;return this}},{key:"getMessage",value:function e(t){return this._messages&&this._messages.hasOwnProperty(t)?this._messages[t]:""}},{key:"setMessage",value:function e(t,i){this._messages[t]=i;return this}},{key:"setHandler",value:function e(t,i){if(typeof i=="function"){this._handlers[t]=i}return this}},{key:"callHandler",value:function e(t,i){if(typeof this._handlers[t]=="function"){this._handlers[t].apply(this,i)}}},{key:"start",value:function e(){this.callHandler("start");s.EventEmitter.emit(W.Start,new s.BaseEvent({dialog:this}))}},{key:"stop",value:function e(){this.callHandler("stop");s.EventEmitter.emit(W.Stop,new s.BaseEvent({dialog:this}))}},{key:"show",value:function e(){if(this.isShown){return}var t=document.querySelector("#bx-admin-prefix");if(t){this.isAdminPanel=true}this.progressBar=new BX.UI.ProgressBar({statusType:BX.UI.ProgressBar.Status.COUNTER,size:this.isAdminPanel?BX.UI.ProgressBar.Size.LARGE:BX.UI.ProgressBar.Size.MEDIUM,fill:this.isAdminPanel,column:!this.isAdminPanel});this.error=new r.Alert({color:r.AlertColor.DANGER,icon:r.AlertIcon.DANGER,size:r.AlertSize.SMALL});this.warning=new r.Alert({color:r.AlertColor.WARNING,icon:r.AlertIcon.WARNING,size:r.AlertSize.SMALL});this.popupWindow=n.PopupManager.create({id:this.getId(),cacheable:false,titleBar:this.getMessage("title"),autoHide:false,closeByEsc:false,closeIcon:true,content:this._prepareDialogContent(),draggable:true,buttons:this._prepareDialogButtons(),className:X.ProcessWindow,bindOptions:{forceBindPosition:false},events:{onClose:BX.delegate(this.onDialogClose,this)},overlay:true,resizable:true,minWidth:Number.parseInt(this.getSetting("minWidth",500)),maxWidth:Number.parseInt(this.getSetting("maxWidth",1e3))});if(!this.popupWindow.isShown()){this.popupWindow.show()}this.isShown=this.popupWindow.isShown();if(this.isShown){this.callHandler("dialogShown");s.EventEmitter.emit(W.Shown,new s.BaseEvent({dialog:this}))}return this}},{key:"close",value:function e(){if(!this.isShown){return}if(this.popupWindow){this.popupWindow.close()}this.isShown=false;this.callHandler("dialogClosed");s.EventEmitter.emit(W.Closed,new s.BaseEvent({dialog:this}));return this}},{key:"_prepareDialogContent",value:function e(){var t=this;this.summaryBlock=a.Tag.render(F||(F=babelHelpers.taggedTemplateLiteral(['<div class="','">',"</div>"])),X.ProcessSummary,this.getMessage("summary"));this.errorBlock=this.error.getContainer();this.warningBlock=this.warning.getContainer();this.errorBlock.style.display="none";this.warningBlock.style.display="none";if(this.progressBar){this.progressBarBlock=a.Tag.render(L||(L=babelHelpers.taggedTemplateLiteral(['<div class="','" style="display:none"></div>'])),X.ProcessProgressbar);this.progressBarBlock.appendChild(this.progressBar.getContainer())}if(!this.optionsFieldsBlock){this.optionsFieldsBlock=a.Tag.render(N||(N=babelHelpers.taggedTemplateLiteral(['<div class="','" style="display:none"></div>'])),X.ProcessOptions)}else{a.Dom.clean(this.optionsFieldsBlock)}var i=this.getSetting("optionsFields",{});var s=this.getSetting("optionsFieldsValue",{});Object.keys(i).forEach((function(e){var n=s[e]?s[e]:null;var r=t._renderOption(i[e],n);if(r instanceof HTMLElement){t.optionsFieldsBlock.appendChild(r);t.optionsFieldsBlock.style.display="block"}}));var n=a.Tag.render(j||(j=babelHelpers.taggedTemplateLiteral(['<div class="','"></div>'])),X.ProcessPopup);n.appendChild(this.summaryBlock);n.appendChild(this.warningBlock);n.appendChild(this.errorBlock);if(this.progressBarBlock){n.appendChild(this.progressBarBlock)}if(this.optionsFieldsBlock){n.appendChild(this.optionsFieldsBlock)}return n}},{key:"_renderOption",value:function e(t){var i=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;t.id=this.id+"_opt_"+t.name;switch(t.type){case"text":this.fields[t.name]=new S(t);break;case"file":this.fields[t.name]=new B(t);break;case"checkbox":this.fields[t.name]=new R(t);break;case"select":this.fields[t.name]=new D(t);break;case"radio":this.fields[t.name]=new A(t);break}if(i!==null){this.fields[t.name].setValue(i)}var s=this.fields[t.name].getContainer();return s}},{key:"onDialogClose",value:function e(){if(this.popupWindow){this.popupWindow.destroy();this.popupWindow=null}this.buttons={};this.fields={};this.summaryBlock=null;this.isShown=false;this.callHandler("dialogClosed");s.EventEmitter.emit(W.Closed,new s.BaseEvent({dialog:this}))}},{key:"handleStartButtonClick",value:function e(){var t=this.getButton("start");if(t&&t.isDisabled()){return}this.start()}},{key:"handleStopButtonClick",value:function e(){var t=this.getButton("stop");if(t&&t.isDisabled()){return}this.stop()}},{key:"handleCloseButtonClick",value:function e(){this.popupWindow.close()}},{key:"_prepareDialogButtons",value:function e(){var t=this.getSetting("showButtons");var i=[];this.buttons={};if(t.start){var s=this.getMessage("startButton");this.buttons.start=new l.Button({text:s||"Start",color:l.Button.Color.SUCCESS,icon:l.Button.Icon.START,events:{click:BX.delegate(this.handleStartButtonClick,this)}});i.push(this.buttons.start)}if(t.stop){var n=this.getMessage("stopButton");this.buttons.stop=new l.Button({text:n||"Stop",color:l.Button.Color.LIGHT_BORDER,icon:l.Button.Icon.STOP,events:{click:BX.delegate(this.handleStopButtonClick,this)}});this.buttons.stop.setDisabled();i.push(this.buttons.stop)}if(t.close){var r=this.getMessage("closeButton");this.buttons.close=new l.CancelButton({text:r||"Close",color:l.Button.Color.LIGHT_BORDER,tag:l.Button.Tag.SPAN,events:{click:BX.delegate(this.handleCloseButtonClick,this)}});i.push(this.buttons.close)}return i}},{key:"setDownloadButtons",value:function e(t,i,s){var n=[];if(t){var r=this.getMessage("downloadButton");r=r!==""?r:"Download file";var a=new l.Button({text:r,color:l.Button.Color.SUCCESS,icon:l.Button.Icon.DOWNLOAD,className:X.ButtonDownload,tag:l.Button.Tag.LINK,link:t,props:{download:i}});n.push(a)}if(typeof s=="function"){var o=this.getMessage("clearButton");o=o!==""?o:"Delete file";var u=new l.Button({text:o,color:l.Button.Color.LIGHT_BORDER,icon:l.Button.Icon.REMOVE,className:X.ButtonRemove,events:{click:s}});n.push(u)}if(this.buttons.close){n.push(this.buttons.close)}if(n.length>0&&this.popupWindow){this.popupWindow.setButtons(n)}return this}},{key:"resetButtons",value:function e(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{start:true,stop:true,close:true};this._prepareDialogButtons();t=t||this.getSetting("showButtons");var i=[];if(t.start){i.push(this.buttons.start)}if(t.stop){i.push(this.buttons.stop)}if(t.close){i.push(this.buttons.close)}if(i.length>0&&this.popupWindow){this.popupWindow.setButtons(i)}return this}},{key:"getButton",value:function e(t){var i;return(i=this.buttons[t])!==null&&i!==void 0?i:null}},{key:"lockButton",value:function e(t,i,s){var n=this.getButton(t);if(n){n.setDisabled(i);if(a.Type.isBoolean(s)){n.setWaiting(s)}}return this}},{key:"showButton",value:function e(t,i){var s=this.getButton(t);if(s){s.getContainer().style.display=!!i?"":"none"}if(t==="close"){if(this.popupWindow&&this.popupWindow.closeIcon){this.popupWindow.closeIcon.style.display=!!i?"":"none"}}return this}},{key:"setSummary",value:function e(t){var i=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;if(this.optionsFieldsBlock){BX.clean(this.optionsFieldsBlock);this.optionsFieldsBlock.style.display="none"}if(a.Type.isStringFilled(t)){if(this.summaryBlock){if(!!i)this.summaryBlock.innerHTML=t;else this.summaryBlock.innerHTML=BX.util.htmlspecialchars(t);this.summaryBlock.style.display="block"}}else{this.summaryBlock.innerHTML="";this.summaryBlock.style.display="none"}return this}},{key:"setErrors",value:function e(t){var i=this;var s=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;t.forEach((function(e){return i.setError(e,s)}));return this}},{key:"setError",value:function e(t,i){if(a.Type.isStringFilled(t)){this.setSummary("");if(this.progressBar){this.progressBar.setColor(BX.UI.ProgressBar.Color.DANGER)}if(!!i){this.error.setText(t)}else{this.error.setText(BX.util.htmlspecialchars(t))}this.errorBlock.style.display="flex"}return this}},{key:"clearErrors",value:function e(){if(this.error){this.error.setText("")}if(this.errorBlock){this.errorBlock.style.display="none"}return this}},{key:"setWarning",value:function e(t){var i=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;if(a.Type.isStringFilled(t)){if(!!i){this.warning.setText(t)}else{this.warning.setText(BX.util.htmlspecialchars(t))}this.warningBlock.style.display="flex"}return this}},{key:"clearWarnings",value:function e(){if(this.warning){this.warning.setText("")}if(this.warningBlock){this.warningBlock.style.display="none"}return this}},{key:"setProgressBar",value:function e(t,i,s){if(this.progressBar){if(a.Type.isNumber(i)&&a.Type.isNumber(t)&&t>0){BX.show(this.progressBarBlock);this.progressBar.setColor(BX.UI.ProgressBar.Color.PRIMARY);this.progressBar.setMaxValue(t);s=s||"";this.progressBar.setTextBefore(s);this.progressBar.update(i)}else{this.hideProgressBar()}}return this}},{key:"hideProgressBar",value:function e(){if(this.progressBar){BX.hide(this.progressBarBlock)}return this}},{key:"getOptionField",value:function e(t){if(a.Type.isString(t)){if(this.fields[t]&&this.fields[t]instanceof v){return this.fields[t]}}return null}},{key:"getOptionFieldValues",value:function e(){var t=this;var i={};if(this.optionsFieldsBlock){Object.keys(this.fields).forEach((function(e){var s=t.getOptionField(e);var n=s.getValue();if(s.type==="checkbox"&&a.Type.isBoolean(n)){i[e]=n?"Y":"N"}else if(a.Type.isArray(n)){if(a.Type.isArrayFilled(n)){i[e]=n}}else if(n){i[e]=n}}))}return i}},{key:"checkOptionFields",value:function e(){var t=this;var i=true;if(this.optionsFieldsBlock){Object.keys(this.fields).forEach((function(e){var s=t.getOptionField(e);if(s.obligatory){if(!s.isFilled()){s.showWarning();i=false}else{s.hideWarning()}}}))}return i}},{key:"lockOptionFields",value:function e(){var t=this;var i=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;if(this.optionsFieldsBlock){Object.keys(this.fields).forEach((function(e){var s=t.getOptionField(e);if(s){s.lock(i)}}))}return this}}]);return e}();var z={StateChanged:"BX.UI.StepProcessing.StateChanged",BeforeRequest:"BX.UI.StepProcessing.BeforeRequest"};var V={StateChanged:"StateChanged",RequestStart:"RequestStart",RequestStop:"RequestStop",RequestFinalize:"RequestFinalize",StepCompleted:"StepCompleted"};var G={AuthError:a.Loc.getMessage("UI_STEP_PROCESSING_AUTH_ERROR"),RequestError:a.Loc.getMessage("UI_STEP_PROCESSING_REQUEST_ERR"),DialogStartButton:a.Loc.getMessage("UI_STEP_PROCESSING_BTN_START"),DialogStopButton:a.Loc.getMessage("UI_STEP_PROCESSING_BTN_STOP"),DialogCloseButton:a.Loc.getMessage("UI_STEP_PROCESSING_BTN_CLOSE"),RequestCanceling:a.Loc.getMessage("UI_STEP_PROCESSING_CANCELING"),RequestCanceled:a.Loc.getMessage("UI_STEP_PROCESSING_CANCELED"),RequestCompleted:a.Loc.getMessage("UI_STEP_PROCESSING_COMPLETED"),DialogExportDownloadButton:a.Loc.getMessage("UI_STEP_PROCESSING_FILE_DOWNLOAD"),DialogExportClearButton:a.Loc.getMessage("UI_STEP_PROCESSING_FILE_DELETE"),WaitingResponse:a.Loc.getMessage("UI_STEP_PROCESSING_WAITING")};var Y={Controller:"controller",Component:"component"};var K=function(){function e(t){babelHelpers.classCallCheck(this,e);babelHelpers.defineProperty(this,"action","");babelHelpers.defineProperty(this,"method","POST");babelHelpers.defineProperty(this,"params",{});babelHelpers.defineProperty(this,"isRequestRunning",false);babelHelpers.defineProperty(this,"queue",[]);babelHelpers.defineProperty(this,"currentStep",-1);babelHelpers.defineProperty(this,"state",u.intermediate);babelHelpers.defineProperty(this,"initialOptionValues",{});babelHelpers.defineProperty(this,"optionsFields",{});babelHelpers.defineProperty(this,"handlers",{});babelHelpers.defineProperty(this,"messages",new Map);this.options=a.Type.isPlainObject(t)?t:{};this.id=this.getOption("id","");if(!a.Type.isStringFilled(this.id)){this.id="Process_"+a.Text.getRandom().toLowerCase()}var i=this.getOption("controller","");var s=this.getOption("component","");if(a.Type.isStringFilled(i)){this.controller=i;this.controllerDefault=i;this.endpointType=Y.Controller}else if(a.Type.isStringFilled(s)){this.component=s;this.endpointType=Y.Component;this.componentMode=this.getOption("componentMode","class")}if(!a.Type.isStringFilled(this.controller)){if(!a.Type.isStringFilled(this.component)){throw new TypeError("BX.UI.StepProcessing: There no any ajax endpoint was defined.")}}this.setQueue(this.getOption("queue",[])).setParams(this.getOption("params",{})).setOptionsFields(this.getOption("optionsFields",{})).setHandlers(this.getOption("handlers",{})).setMessages(G).setMessages(this.getOption("messages",{}))}babelHelpers.createClass(e,[{key:"destroy",value:function e(){if(this.dialog instanceof U){this.dialog.close().destroy();this.dialog=null}this._closeConnection()}},{key:"start",value:function e(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:1;this._refreshHash();t=t||1;if(this.state===u.intermediate||this.state===u.stopped||this.state===u.completed){if(!this.getDialog().checkOptionFields()){return}this.getDialog().clearErrors().clearWarnings();this.networkErrorCount=0;if(this.getQueueLength()>0){this.currentStep=0;if(t>1){this.currentStep=t-1}if(this.endpointType===Y.Controller){if(a.Type.isStringFilled(this.queue[this.currentStep].controller)){this.setController(this.queue[this.currentStep].controller)}}if(!a.Type.isStringFilled(this.queue[this.currentStep].action)){throw new Error("BX.UI.StepProcessing: Could not find controller action at the queue position.")}this.setAction(this.queue[this.currentStep].action);this.startRequest();if(this.queue[this.currentStep].title){this.getDialog().setSummary(this.queue[this.currentStep].title)}else{this.getDialog().setSummary(this.getMessage("WaitingResponse"))}}else{this.startRequest()}}return this}},{key:"stop",value:function e(){if(this.state===u.running){this.stopRequest();this.currentStep=-1}return this}},{key:"startRequest",value:function e(){var t=this;if(this.isRequestRunning||this.state===u.canceling){return this.ajaxPromise}this.isRequestRunning=true;this.ajaxPromise=null;var i=new FormData;var n=function e(t,s){if(a.Type.isPlainObject(t)){Object.keys(t).forEach((function(n){var r=n;if(s){r=s+"["+n+"]"}if(a.Type.isArray(t[n])||a.Type.isPlainObject(t[n])){e(t[n],r)}else{i.append(r,t[n])}}))}else if(a.Type.isArray(t)){t.forEach((function(e){return i.append(s+"[]",e)}))}};n(this.params);if(this.queue[this.currentStep].params){n(this.queue[this.currentStep].params)}var r=this.getDialog().getOptionFieldValues();if(BX.type.isNotEmptyObject(r)){n(r);this.initialOptionValues=r;this.storeOptionFieldValues(r)}else{Object.keys(this.initialOptionValues).forEach((function(e){if(t.initialOptionValues[e]instanceof File){delete t.initialOptionValues[e]}}));n(this.initialOptionValues)}this.setState(u.running);if(this.hasActionHandler(V.RequestStart)){this.callActionHandler(V.RequestStart,[i])}else if(this.hasHandler(V.RequestStart)){this.callHandler(V.RequestStart,[i])}s.EventEmitter.emit(z.BeforeRequest,new s.BaseEvent({data:{process:this,actionData:i}}));var l={data:i,method:this.method,onrequeststart:this._onRequestStart.bind(this)};if(this.endpointType===Y.Controller){this.ajaxPromise=BX.ajax.runAction(this.controller+"."+this.getAction(),l).then(this._onRequestSuccess.bind(this),this._onRequestFailure.bind(this))}else if(this.endpointType===Y.Component){l.data.mode=this.componentMode;if("signedParameters"in l.data){l.signedParameters=l.data.signedParameters;delete l.data.signedParameters}this.ajaxPromise=BX.ajax.runComponentAction(this.component,this.getAction(),l).then(this._onRequestSuccess.bind(this),this._onRequestFailure.bind(this))}return this.ajaxPromise}},{key:"stopRequest",value:function e(){if(this.state===u.canceling){return this.ajaxPromise}this.setState(u.canceling);this._closeConnection();var t=BX.clone(this.params);t.cancelingAction=this.getAction();this.getDialog().setSummary(this.getMessage("RequestCanceling"));var i=true;if(this.hasActionHandler(V.RequestStop)){i=false;this.callActionHandler(V.RequestStop,[t])}else if(this.hasHandler(V.RequestStop)){i=false;this.callHandler(V.RequestStop,[t])}s.EventEmitter.emit(z.BeforeRequest,new s.BaseEvent({data:{process:this,actionData:t}}));this.ajaxPromise=null;if(i){var n={data:t,method:this.method,onrequeststart:this._onRequestStart.bind(this)};if(this.endpointType===Y.Controller){this.setController(this.controllerDefault);this.ajaxPromise=BX.ajax.runAction(this.controller+".cancel",n).then(this._onRequestSuccess.bind(this),this._onRequestFailure.bind(this))}else if(this.endpointType===Y.Component){n.data.mode=this.componentMode;if("signedParameters"in n.data){n.signedParameters=n.data.signedParameters;delete n.data.signedParameters}this.ajaxPromise=BX.ajax.runComponentAction(this.component,"cancel",n).then(this._onRequestSuccess.bind(this),this._onRequestFailure.bind(this))}}return this.ajaxPromise}},{key:"finalizeRequest",value:function e(){if(this.state===u.canceling){return this.ajaxPromise}var t=BX.clone(this.params);var i=true;if(this.hasActionHandler(V.RequestFinalize)){i=false;this.callActionHandler(V.RequestFinalize,[t])}else if(this.hasHandler(V.RequestFinalize)){i=false;this.callHandler(V.RequestFinalize,[t])}s.EventEmitter.emit(z.BeforeRequest,new s.BaseEvent({data:{process:this,actionData:t}}));this.ajaxPromise=null;if(i){var n={data:t,method:this.method,onrequeststart:this._onRequestStart.bind(this)};if(this.endpointType===Y.Controller){this.setController(this.controllerDefault);this.ajaxPromise=BX.ajax.runAction(this.controller+".finalize",n)}else if(this.endpointType===Y.Component){n.data.mode=this.componentMode;if("signedParameters"in n.data){n.signedParameters=n.data.signedParameters;delete n.data.signedParameters}this.ajaxPromise=BX.ajax.runComponentAction(this.component,"finalize",n)}}return this.ajaxPromise}},{key:"_refreshHash",value:function e(){this.hash=this.id+Date.now();this.setParam("PROCESS_TOKEN",this.hash);return this}},{key:"_onRequestSuccess",value:function e(t){this.isRequestRunning=false;this.xhr=null;this.ajaxPromise=null;if(!t){this.getDialog().setError(this.getMessage("RequestError"));this.setState(u.error);return}if(a.Type.isArrayFilled(t.errors)){var i=t.errors.slice(-10);var s=[];i.forEach((function(e){return s.push(e.message)}));this.getDialog().setErrors(s,true);this.setState(u.error);return}this.networkErrorCount=0;var n=t.data;var r=a.Type.isStringFilled(n.STATUS)?n.STATUS:"";var l="";if(a.Type.isStringFilled(n.SUMMARY)){l=n.SUMMARY}else if(a.Type.isStringFilled(n.SUMMARY_HTML)){l=n.SUMMARY_HTML}var h=a.Type.isNumber(n.PROCESSED_ITEMS)?n.PROCESSED_ITEMS:0;var p=a.Type.isNumber(n.TOTAL_ITEMS)?n.TOTAL_ITEMS:0;var d=!!n.FINALIZE;if(this.hasActionHandler(V.StepCompleted)){this.callActionHandler(V.StepCompleted,[r,n])}if(a.Type.isStringFilled(n.WARNING)){this.getDialog().setWarning(n.WARNING)}if(r===o.progress||r===o.completed){if(p>0){if(this.queue[this.currentStep].progressBarTitle){this.getDialog().setProgressBar(p,h,this.queue[this.currentStep].progressBarTitle)}else{this.getDialog().setProgressBar(p,h)}}else{this.getDialog().hideProgressBar()}}if(r===o.progress){if(l!==""){this.getDialog().setSummary(l,true)}if(this.state===u.canceling){this.setState(u.stopped)}else{if(this.endpointType===Y.Controller){var c=a.Type.isStringFilled(n.NEXT_CONTROLLER)?n.NEXT_CONTROLLER:"";if(c!==""){this.setController(c)}else if(a.Type.isStringFilled(this.queue[this.currentStep].controller)){this.setController(this.queue[this.currentStep].controller)}else{this.setController(this.controllerDefault)}}var f=a.Type.isStringFilled(n.NEXT_ACTION)?n.NEXT_ACTION:"";if(f!==""){this.setAction(f)}setTimeout(BX.delegate(this.startRequest,this),100)}return}if(this.state===u.canceling){this.getDialog().setSummary(this.getMessage("RequestCanceled"));this.setState(u.completed)}else if(r===o.completed){if(this.getQueueLength()>0&&this.currentStep+1<this.getQueueLength()){this.currentStep++;if(this.endpointType===Y.Controller){if(a.Type.isStringFilled(this.queue[this.currentStep].controller)){this.setController(this.queue[this.currentStep].controller)}else{this.setController(this.controllerDefault)}}if(!a.Type.isStringFilled(this.queue[this.currentStep].action)){throw new Error("BX.UI.StepProcessing: Could not find controller action at the queue position.")}if("finalize"in this.queue[this.currentStep]){d=true;this.setAction(this.queue[this.currentStep].action)}else{this.setAction(this.queue[this.currentStep].action);this.getDialog().setSummary(this.queue[this.currentStep].title);setTimeout(BX.delegate(this.startRequest,this),100);return}}if(l!==""){this.getDialog().setSummary(l,true)}else{this.getDialog().setSummary(this.getMessage("RequestCompleted"))}if(a.Type.isStringFilled(n.DOWNLOAD_LINK)){if(a.Type.isStringFilled(n.DOWNLOAD_LINK_NAME)){this.getDialog().setMessage("downloadButton",n.DOWNLOAD_LINK_NAME)}if(a.Type.isStringFilled(n.CLEAR_LINK_NAME)){this.getDialog().setMessage("clearButton",n.CLEAR_LINK_NAME)}this.getDialog().setDownloadButtons(n.DOWNLOAD_LINK,n.FILE_NAME,BX.delegate((function(){this.getDialog().resetButtons({stop:true,close:true});this.callAction("clear");setTimeout(BX.delegate((function(){this.getDialog().resetButtons({close:true})}),this),1e3)}),this))}this.setState(u.completed,n);if(d){setTimeout(BX.delegate(this.finalizeRequest,this),100)}}else{this.getDialog().setSummary("").setError(this.getMessage("RequestError"));this.setState(u.error)}}},{key:"_onRequestFailure",value:function e(t){var i=this;this.isRequestRunning=false;this.ajaxPromise=null;if(a.Type.isPlainObject(t)&&"data"in t&&a.Type.isPlainObject(t.data)&&"ajaxRejectData"in t.data&&a.Type.isPlainObject(t.data.ajaxRejectData)&&"reason"in t.data.ajaxRejectData&&t.data.ajaxRejectData.reason==="status"&&"data"in t.data.ajaxRejectData&&t.data.ajaxRejectData.data===401){this.getDialog().setError(this.getMessage("AuthError"))}else if(a.Type.isPlainObject(t)&&"errors"in t&&a.Type.isArrayFilled(t.errors)){var s=false;var n=false;t.errors.forEach((function(e){if(e.code==="NETWORK_ERROR"){if(i.state===u.canceling){s=true}else{n=true}}}));if(s){return}if(n){this.networkErrorCount++;if(this.networkErrorCount<=2){setTimeout(BX.delegate(this.startRequest,this),15e3);return}}var r=t.errors.slice(-10);var l=[];r.forEach((function(e){if(e.code==="NETWORK_ERROR"){l.push(i.getMessage("RequestError"))}else{l.push(e.message)}}));this.getDialog().setErrors(l,true)}else{this.getDialog().setError(this.getMessage("RequestError"))}this.xhr=null;this.currentStep=-1;this.setState(u.error)}},{key:"_closeConnection",value:function e(){if(this.xhr instanceof XMLHttpRequest){try{this.xhr.abort();this.xhr=null}catch(e){}}}},{key:"_onRequestStart",value:function e(t){this.xhr=t}},{key:"setId",value:function e(t){this.id=t;return this}},{key:"getId",value:function e(){return this.id}},{key:"setQueue",value:function e(t){var i=this;t.forEach((function(e){return i.addQueueAction(e)}));return this}},{key:"addQueueAction",value:function e(t){this.queue.push(t);return this}},{key:"getQueueLength",value:function e(){return this.queue.length}},{key:"setOption",value:function e(t,i){this.options[t]=i;return this}},{key:"getOption",value:function e(t){var i=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;return this.options.hasOwnProperty(t)?this.options[t]:i}},{key:"setOptionsFields",value:function e(t){var i=this;Object.keys(t).forEach((function(e){return i.addOptionsField(e,t[e])}));return this}},{key:"addOptionsField",value:function e(t,i){this.optionsFields[t]=i;return this}},{key:"storeOptionFieldValues",value:function e(t){var i=this;if("sessionStorage"in window){var s={};Object.keys(this.optionsFields).forEach((function(e){var n=i.optionsFields[e];switch(n.type){case"checkbox":case"select":case"radio":if(n.name in t){s[n.name]=t[n.name]}break}}));window.sessionStorage.setItem("bx."+this.getId(),JSON.stringify(s))}return this}},{key:"restoreOptionFieldValues",value:function e(){var t={};if("sessionStorage"in window){t=JSON.parse(window.sessionStorage.getItem("bx."+this.getId()));if(!a.Type.isPlainObject(t)){t={}}}return t}},{key:"setParams",value:function e(t){var i=this;this.params={};Object.keys(t).forEach((function(e){return i.setParam(e,t[e])}));return this}},{key:"getParams",value:function e(){return this.params}},{key:"setParam",value:function e(t,i){this.params[t]=i;return this}},{key:"getParam",value:function e(t){return this.params[t]?this.params[t]:null}},{key:"setState",value:function e(t){var i=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};if(this.state===t){return this}this.state=t;if(t===u.intermediate||t===u.stopped){this.getDialog().lockButton("start",false).lockButton("stop",true).showButton("close",true)}else if(t===u.running){this.getDialog().lockButton("start",true,true).lockButton("stop",false).showButton("close",false)}else if(t===u.canceling){this.getDialog().lockButton("start",true).lockButton("stop",true,true).showButton("close",false).hideProgressBar()}else if(t===u.error){this.getDialog().lockButton("start",true).lockButton("stop",true).showButton("close",true)}else if(t===u.completed){this.getDialog().lockButton("start",true).lockButton("stop",true).showButton("close",true).hideProgressBar()}if(this.hasActionHandler(V.StateChanged)){this.callActionHandler(V.StateChanged,[t,i])}else if(this.hasHandler(V.StateChanged)){this.callHandler(V.StateChanged,[t,i])}s.EventEmitter.emit(z.StateChanged,new s.BaseEvent({data:{state:t,result:i}}));return this}},{key:"getState",value:function e(){return this.state}},{key:"setController",value:function e(t){this.controller=t;return this}},{key:"getController",value:function e(){return this.controller}},{key:"setComponent",value:function e(t){var i=arguments.length>1&&arguments[1]!==undefined?arguments[1]:"class";this.component=t;this.componentMode=i;return this}},{key:"getComponent",value:function e(){return this.component}},{key:"setAction",value:function e(t){this.action=t;return this}},{key:"getAction",value:function e(){return this.action}},{key:"callAction",value:function e(t){this.setAction(t)._refreshHash();return this.startRequest()}},{key:"setHandlers",value:function e(t){var i=this;Object.keys(t).forEach((function(e){return i.setHandler(e,t[e])}));return this}},{key:"setHandler",value:function e(t,i){if(a.Type.isFunction(i)){this.handlers[t]=i}return this}},{key:"hasHandler",value:function e(t){return a.Type.isFunction(this.handlers[t])}},{key:"callHandler",value:function e(t,i){if(this.hasHandler(t)){this.handlers[t].apply(this,i)}}},{key:"hasActionHandler",value:function e(t){if(this.queue[this.currentStep]){if("handlers"in this.queue[this.currentStep]){return a.Type.isFunction(this.queue[this.currentStep].handlers[t])}}return false}},{key:"callActionHandler",value:function e(t,i){if(this.hasActionHandler(t)){this.queue[this.currentStep].handlers[t].apply(this,i)}}},{key:"setMessages",value:function e(t){var i=this;Object.keys(t).forEach((function(e){return i.setMessage(e,t[e])}));return this}},{key:"setMessage",value:function e(t,i){this.messages.set(t,i);return this}},{key:"getMessage",value:function e(t){var i=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;var s=this.messages.has(t)?this.messages.get(t):"";if(a.Type.isStringFilled(s)&&a.Type.isPlainObject(i)){Object.keys(i).forEach((function(e){s=s.replace("#"+e+"#",i[e])}))}return s}},{key:"getDialog",value:function e(){if(!this.dialog){this.dialog=new U({id:this.id,optionsFields:this.getOption("optionsFields",{}),minWidth:Number.parseInt(this.getOption("dialogMinWidth",500)),maxWidth:Number.parseInt(this.getOption("dialogMaxWidth",1e3)),optionsFieldsValue:this.restoreOptionFieldValues(),messages:{title:this.getMessage("DialogTitle"),summary:this.getMessage("DialogSummary"),startButton:this.getMessage("DialogStartButton"),stopButton:this.getMessage("DialogStopButton"),closeButton:this.getMessage("DialogCloseButton"),downloadButton:this.getMessage("DialogExportDownloadButton"),clearButton:this.getMessage("DialogExportClearButton")},showButtons:this.getOption("showButtons"),handlers:{start:BX.delegate(this.start,this),stop:BX.delegate(this.stop,this),dialogShown:typeof this.handlers.dialogShown=="function"?this.handlers.dialogShown:null,dialogClosed:typeof this.handlers.dialogClosed=="function"?this.handlers.dialogClosed:null}})}return this.dialog}},{key:"showDialog",value:function e(){this.getDialog().setSetting("optionsFieldsValue",this.restoreOptionFieldValues()).resetButtons(this.getOption("optionsFields")).show();if(!this.isRequestRunning){this.setState(u.intermediate)}return this}},{key:"closeDialog",value:function e(){if(this.isRequestRunning){this.stop()}this.getDialog().close();return this}}]);return e}();var Q=function(){function e(){babelHelpers.classCallCheck(this,e)}babelHelpers.createClass(e,null,[{key:"create",value:function e(t){if(!this.instances){this.instances=new Map}var i=new K(t);this.instances.set(i.getId(),i);return i}},{key:"get",value:function e(t){if(this.instances){if(this.instances.has(t)){return this.instances.get(t)}}return null}},{key:"has",value:function e(t){if(this.instances){return this.instances.has(t)}return false}},{key:"delete",value:function e(t){if(this.instances){if(this.instances.has(t)){this.instances.get(t).destroy();this.instances["delete"](t)}}}}]);return e}();e.ProcessManager=Q;e.Process=K;e.ProcessState=u;e.ProcessEvent=z;e.ProcessCallback=V;e.ProcessResultStatus=o;e.Dialog=U;e.DialogEvent=W})(this.BX.UI.StepProcessing=this.BX.UI.StepProcessing||{},BX,BX.UI,BX.Event,BX.Main,BX.UI,BX.UI,BX);
//# sourceMappingURL=process.bundle.map.js